<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <!-- <el-form-item label="砂碳滤排水" prop="a1">
        <el-input
          v-model="queryParams.a1"
          placeholder="请输入砂碳滤排水"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="砂碳滤升温" prop="a2">
        <el-input
          v-model="queryParams.a2"
          placeholder="请输入砂碳滤升温"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="砂碳滤升压" prop="a3">
        <el-input
          v-model="queryParams.a3"
          placeholder="请输入砂碳滤升压"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="砂碳滤保压" prop="a4">
        <el-input
          v-model="queryParams.a4"
          placeholder="请输入砂碳滤保压"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="砂碳滤排汽" prop="a5">
        <el-input
          v-model="queryParams.a5"
          placeholder="请输入砂碳滤排汽"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="砂滤反冲" prop="a6">
        <el-input
          v-model="queryParams.a6"
          placeholder="请输入砂滤反冲"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="砂滤正冲" prop="a7">
        <el-input
          v-model="queryParams.a7"
          placeholder="请输入砂滤正冲"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="碳滤反冲" prop="a8">
        <el-input
          v-model="queryParams.a8"
          placeholder="请输入碳滤反冲"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="碳滤正冲" prop="a9">
        <el-input
          v-model="queryParams.a9"
          placeholder="请输入碳滤正冲"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="碳滤后取样" prop="a10">
        <el-input
          v-model="queryParams.a10"
          placeholder="请输入碳滤后取样"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="砂碳滤活化起时间" prop="a11">
        <el-date-picker  :editable="false" clearable size="small"
          v-model="queryParams.a11"
          type="date"
          value-format="MM-dd"
              format="MM-dd"
          placeholder="选择砂碳滤活化起时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="砂碳滤活化止时间" prop="a12">
        <el-date-picker  :editable="false" clearable size="small"
          v-model="queryParams.a12"
          type="date"
          value-format="MM-dd"
              format="MM-dd"
          placeholder="选择砂碳滤活化止时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="活化砂碳滤用水情况-余氯含量" prop="a13">
        <el-input
          v-model="queryParams.a13"
          placeholder="请输入活化砂碳滤用水情况-余氯含量"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="活化砂碳滤用水情况-是否添加CO2" prop="a14">
        <el-input
          v-model="queryParams.a14"
          placeholder="请输入活化砂碳滤用水情况-是否添加CO2"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="活化砂碳滤用水情况-澄清度" prop="a15">
        <el-input
          v-model="queryParams.a15"
          placeholder="请输入活化砂碳滤用水情况-澄清度"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="蒸汽管路是否排污" prop="a16">
        <el-input
          v-model="queryParams.a16"
          placeholder="请输入蒸汽管路是否排污"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="蒸汽管路是否排污原因" prop="a17">
        <el-input
          v-model="queryParams.a17"
          placeholder="请输入蒸汽管路是否排污原因"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="蒸汽滤芯是否排污" prop="a18">
        <el-input
          v-model="queryParams.a18"
          placeholder="请输入蒸汽滤芯是否排污"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="蒸汽滤芯是否排污原因" prop="a19">
        <el-input
          v-model="queryParams.a19"
          placeholder="请输入蒸汽滤芯是否排污原因"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否排冷凝水" prop="a20">
        <el-input
          v-model="queryParams.a20"
          placeholder="请输入是否排冷凝水"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否排冷凝水原因" prop="a21">
        <el-input
          v-model="queryParams.a21"
          placeholder="请输入是否排冷凝水原因"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="蒸汽滤芯压力" prop="a22">
        <el-input
          v-model="queryParams.a22"
          placeholder="请输入蒸汽滤芯压力"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否用尾汽对管路杀菌" prop="a23">
        <el-input
          v-model="queryParams.a23"
          placeholder="请输入是否用尾汽对管路杀菌"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="砂碳滤活化完成后" prop="a24">
        <el-input
          v-model="queryParams.a24"
          placeholder="请输入砂碳滤活化完成后"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="碳滤后水质情况-余氯含量" prop="a25">
        <el-input
          v-model="queryParams.a25"
          placeholder="请输入碳滤后水质情况-余氯含量"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="砂碳滤活化完成后" prop="a26">
        <el-input
          v-model="queryParams.a26"
          placeholder="请输入砂碳滤活化完成后"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="碳滤后水质情况-澄清度" prop="a27">
        <el-input
          v-model="queryParams.a27"
          placeholder="请输入碳滤后水质情况-澄清度"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="砂碳滤活化完成后" prop="a28">
        <el-input
          v-model="queryParams.a28"
          placeholder="请输入砂碳滤活化完成后"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="碳滤后水质情况-杂质" prop="a29">
        <el-input
          v-model="queryParams.a29"
          placeholder="请输入碳滤后水质情况-杂质"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="活化砂碳滤总用水量" prop="a30">
        <el-input
          v-model="queryParams.a30"
          placeholder="请输入活化砂碳滤总用水量"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="活化后取样Fe2+" prop="a31">
        <el-input
          v-model="queryParams.a31"
          placeholder="请输入活化后取样Fe2+"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="活化后取样Mn2+" prop="a32">
        <el-input
          v-model="queryParams.a32"
          placeholder="请输入活化后取样Mn2+"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="生产前用水Fe2+" prop="a33">
        <el-input
          v-model="queryParams.a33"
          placeholder="请输入生产前用水Fe2+"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="生产前用水Mn2+" prop="a34">
        <el-input
          v-model="queryParams.a34"
          placeholder="请输入生产前用水Mn2+"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="活化后取样Fe2+" prop="a35">
        <el-input
          v-model="queryParams.a35"
          placeholder="请输入活化后取样Fe2+"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="活化后取样Mn2+" prop="a36">
        <el-input
          v-model="queryParams.a36"
          placeholder="请输入活化后取样Mn2+"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="生产前用水Fe2+" prop="a37">
        <el-input
          v-model="queryParams.a37"
          placeholder="请输入生产前用水Fe2+"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="生产前用水Mn2+" prop="a38">
        <el-input
          v-model="queryParams.a38"
          placeholder="请输入生产前用水Mn2+"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="微生物检测结果" prop="a39">
        <el-input
          v-model="queryParams.a39"
          placeholder="请输入微生物检测结果"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <el-form-item label="审核人" prop="a40">
        <el-input v-model="queryParams.a40" placeholder="请输入审核人" clearable size="small" @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="质检员" prop="a41">
        <el-input v-model="queryParams.a41" placeholder="请输入质检员" clearable size="small" @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="化验员" prop="a42">
        <el-input v-model="queryParams.a42" placeholder="请输入化验员" clearable size="small" @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="报表编号" prop="bbbh">
        <el-input v-model="queryParams.bbbh" placeholder="请输入报表编号" clearable size="small" @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['Productionline_carbon:carbon:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['Productionline_carbon:carbon:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['Productionline_carbon:carbon:remove']">删除</el-button>
      </el-col>
      <!--  <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['Productionline_carbon:carbon:export']"
          >导出</el-button
        >
      </el-col> -->
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-s-check" size="mini" :disabled="multiple" @click="handleCheck" v-hasPermi="['Productionline_carbon:carbon:check']">审核</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="carbonList" @selection-change="handleSelectionChange" max-height="550">
      <el-table-column type="selection" width="55" align="center" />

      <!-- <el-table-column label="报表编号" align="center" prop="id" /> -->
      <!-- <el-table-column label="砂碳滤排水" align="center" prop="a1" />
      <el-table-column label="砂碳滤升温" align="center" prop="a2" />
      <el-table-column label="砂碳滤升压" align="center" prop="a3" />
      <el-table-column label="砂碳滤保压" align="center" prop="a4" />
      <el-table-column label="砂碳滤排汽" align="center" prop="a5" />
      <el-table-column label="砂滤反冲" align="center" prop="a6" />
      <el-table-column label="砂滤正冲" align="center" prop="a7" />
      <el-table-column label="碳滤反冲" align="center" prop="a8" />
      <el-table-column label="碳滤正冲" align="center" prop="a9" />
      <el-table-column label="碳滤后取样" align="center" prop="a10" />
      <el-table-column label="砂碳滤活化起时间" align="center" prop="a11" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.a11, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="砂碳滤活化止时间" align="center" prop="a12" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.a12, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="活化砂碳滤用水情况-余氯含量" align="center" prop="a13" />
      <el-table-column label="活化砂碳滤用水情况-是否添加CO2" align="center" prop="a14" />
      <el-table-column label="活化砂碳滤用水情况-澄清度" align="center" prop="a15" />
      <el-table-column label="蒸汽管路是否排污" align="center" prop="a16" />
      <el-table-column label="蒸汽管路是否排污原因" align="center" prop="a17" />
      <el-table-column label="蒸汽滤芯是否排污" align="center" prop="a18" />
      <el-table-column label="蒸汽滤芯是否排污原因" align="center" prop="a19" />
      <el-table-column label="是否排冷凝水" align="center" prop="a20" />
      <el-table-column label="是否排冷凝水原因" align="center" prop="a21" />
      <el-table-column label="蒸汽滤芯压力" align="center" prop="a22" />
      <el-table-column label="是否用尾汽对管路杀菌" align="center" prop="a23" />
      <el-table-column label="砂碳滤活化完成后" align="center" prop="a24" />
      <el-table-column label="碳滤后水质情况-余氯含量" align="center" prop="a25" />
      <el-table-column label="砂碳滤活化完成后" align="center" prop="a26" />
      <el-table-column label="碳滤后水质情况-澄清度" align="center" prop="a27" />
      <el-table-column label="砂碳滤活化完成后" align="center" prop="a28" />
      <el-table-column label="碳滤后水质情况-杂质" align="center" prop="a29" />
      <el-table-column label="活化砂碳滤总用水量" align="center" prop="a30" />
      <el-table-column label="活化后取样Fe2+" align="center" prop="a31" />
      <el-table-column label="活化后取样Mn2+" align="center" prop="a32" />
      <el-table-column label="生产前用水Fe2+" align="center" prop="a33" />
      <el-table-column label="生产前用水Mn2+" align="center" prop="a34" /> -->
      <!-- <el-table-column label="活化后取样Fe2+" align="center" prop="a35" />
      <el-table-column label="活化后取样Mn2+" align="center" prop="a36" />
      <el-table-column label="生产前用水Fe2+" align="center" prop="a37" />
      <el-table-column label="生产前用水Mn2+" align="center" prop="a38" />
      <el-table-column label="微生物检测结果" align="center" prop="a39" /> -->
      <el-table-column label="序号" align="center" prop="id" />
      <el-table-column label="报表编号" align="center" prop="bbbh" />
      <el-table-column label="报表时间" align="center" prop="jcrq" />
      <el-table-column label="质检员" align="center" prop="a41" />
      <el-table-column label="化验员" align="center" prop="a42" />
      <el-table-column label="审核人" align="center" prop="a40" />
      <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width"
                       min-width="250px">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="excelhandleView(scope.row)"
          >导出</el-button            >
          <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)">查看</el-button>
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['Productionline_carbon:carbon:edit']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['Productionline_carbon:carbon:remove']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />

    <!-- 添加或修改活化砂碳滤过程记录对话框 -->
    <!-- <el-dialog v-myFullscreen :title="title" :visible.sync="open" width="900px" append-to-body> -->
    <el-dialog v-myFullscreen :title="title" :visible.sync="open" append-to-body width="900px" custom-class="myDialog" fullscreen>
      <TableHeader @nameChange="nameChange" :data="{
          mainTitle: '活化砂碳滤过程记录',
          company: '青岛崂山矿泉水有限公司',
          code: form.bbbh,
        }" />

      <el-form ref="form" :model="form" :rules="rules" label-width="90px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="报表日期" prop="jcrq">
              <el-date-picker :editable="false" clearable v-model="form.jcrq" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="报表日期" :disabled="openDisabled">

              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="砂碳滤排水" prop="a1">
              <!-- <el-input
                v-model="form.a1"
                placeholder="请输入砂碳滤排水"
                :disabled="openDisabled"
              /> -->

              <el-date-picker :editable="false" clearable v-model="form.a1" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="时间" :disabled="openDisabled">
              </el-date-picker>

            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="砂碳滤活化起时间" prop="a11" label-width="130px">
              <el-date-picker :editable="false" clearable size="small" v-model="form.a11" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="选择砂碳滤活化起时间" :disabled="openDisabled">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="砂碳滤活化止时间" prop="a12" label-width="130px">
              <el-date-picker :editable="false" clearable size="small" v-model="form.a12" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="选择砂碳滤活化止时间" :disabled="openDisabled">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="砂碳滤升温" prop="a2">
              <!-- <el-input
                v-model="form.a2"
                placeholder="请输入砂碳滤升温"
                :disabled="openDisabled"
              /> -->
              <el-date-picker :editable="false" clearable v-model="form.a2" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="时间" :disabled="openDisabled">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="活化砂碳余氯含量" label-width="130px" prop="a13">
              <el-input v-model="form.a13" placeholder="请输入活化砂碳滤用水情况-余氯含量" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否添加CO2" label-width="100px" prop="a14">
              <!-- <el-input v-model="form.a14" placeholder="请输入活化砂碳滤用水情况-是否添加CO2" :disabled="openDisabled" /> -->
              <el-select v-model="form.a14" :disabled="openDisabled">
                <el-option value="是">是</el-option>
                <el-option value="否">否</el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="砂碳滤升压" prop="a3">
              <!-- <el-input
                v-model="form.a3"
                placeholder="请输入砂碳滤升压"
                :disabled="openDisabled"
              /> -->
              <el-date-picker :editable="false" clearable v-model="form.a3" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="时间" :disabled="openDisabled">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="16">
            <el-form-item label="活化砂碳滤澄清度" prop="a15" label-width="130px">
              <el-input v-model="form.a15" placeholder="请输入活化砂碳滤用水情况-澄清度" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="砂碳滤保压" prop="a4">
              <!-- <el-input
                v-model="form.a4"
                placeholder="请输入砂碳滤保压"
                :disabled="openDisabled"
              /> -->
              <el-date-picker :editable="false" clearable v-model="form.a4" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="时间" :disabled="openDisabled">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="蒸汽管路是否排污" prop="a16" label-width="130px">
              <el-select v-model="form.a16">
                <el-option value="是">是</el-option>
                <el-option value="否">否</el-option>
              </el-select>
              <!-- <el-input v-model="form.a16" placeholder="请输入蒸汽管路是否排污" :disabled="openDisabled" /> -->
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="原因" prop="a17">
              <el-input type="textarea" v-model="form.a17" placeholder="请输入蒸汽管路是否排污原因" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="砂碳滤排汽" prop="a5">
              <!-- <el-input
                v-model="form.a5"
                placeholder="请输入砂碳滤排汽"
                :disabled="openDisabled"
              /> -->
              <el-date-picker :editable="false" clearable v-model="form.a5" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="时间" :disabled="openDisabled">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="蒸汽滤芯是否排污" prop="a18" label-width="130px">
              <!-- <el-input v-model="form.a18" placeholder="请输入蒸汽滤芯是否排污" :disabled="openDisabled" /> -->
              <el-select v-model="form.a18">
                <el-option value="是">是</el-option>
                <el-option value="否">否</el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="原因" prop="a19">
              <el-input type="textarea" v-model="form.a19" placeholder="请输入蒸汽滤芯是否排污原因" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="砂滤反冲" prop="a6">
              <!-- <el-input
                v-model="form.a6"
                placeholder="请输入砂滤反冲"
                :disabled="openDisabled"
              /> -->
              <el-date-picker :editable="false" clearable v-model="form.a6" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="时间" :disabled="openDisabled">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否排冷凝水" prop="a20" label-width="130px">
              <!-- <el-input v-model="form.a20" placeholder="请输入是否排冷凝水" :disabled="openDisabled" /> -->
              <el-select v-model="form.a20">
                <el-option value="是">是</el-option>
                <el-option value="否">否</el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="原因" prop="a21">
              <el-input type="textarea" v-model="form.a21" placeholder="请输入是否排冷凝水原因" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="砂滤正冲" prop="a7">
              <!-- <el-input
                v-model="form.a7"
                placeholder="请输入砂滤正冲"
                :disabled="openDisabled"
              /> -->
              <el-date-picker :editable="false" clearable v-model="form.a7" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="时间" :disabled="openDisabled">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="16">
            <el-form-item label="蒸汽滤芯压力（MPa）" prop="a22" label-width="160px">
              <el-input v-model="form.a22" placeholder="请输入蒸汽滤芯压力" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="碳滤反冲" prop="a8">
              <!-- <el-input
                v-model="form.a8"
                placeholder="请输入碳滤反冲"
                :disabled="openDisabled"
              /> -->
              <el-date-picker :editable="false" clearable v-model="form.a8" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="时间" :disabled="openDisabled">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否用尾汽对管路杀菌" prop="a23" label-width="160px">
              <!-- <el-input v-model="form.a23" placeholder="请输入是否用尾汽对管路杀菌" :disabled="openDisabled" /> -->

              <el-select v-model="form.a23">
                <el-option value="是">是</el-option>
                <el-option value="否">否</el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="原因" prop="a24">
              <el-input type="textarea" v-model="form.a24" placeholder="请输入蒸汽滤芯压力原因" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="碳滤正冲" prop="a9">
              <!-- <el-input
                v-model="form.a9"
                placeholder="请输入碳滤正冲"
                :disabled="openDisabled"
              /> -->
              <el-date-picker :editable="false" clearable v-model="form.a9" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="时间" :disabled="openDisabled">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
                <el-form-item label="砂碳滤活化完成后" prop="a24">
                  <el-input v-model="form.a24" placeholder="请输入砂碳滤活化完成后" :disabled="openDisabled" />
                </el-form-item>
            </el-col> -->
          <el-col :span="16">
            <el-form-item label="碳滤后水质情况-余氯含量" prop="a25" label-width="180px">
              <el-input v-model="form.a25" placeholder="请输入碳滤后水质情况-余氯含量" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
                <el-form-item label="砂碳滤活化完成后" prop="a26">
                  <el-input v-model="form.a26" placeholder="请输入砂碳滤活化完成后" :disabled="openDisabled" />
                </el-form-item>
            </el-col> -->
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="碳滤后水质情况-澄清度" prop="a27" label-width="180px">
              <el-input v-model="form.a27" placeholder="请输入碳滤后水质情况-澄清度" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
                <el-form-item label="砂碳滤活化完成后" prop="a28">
                  <el-input v-model="form.a28" placeholder="请输入砂碳滤活化完成后" :disabled="openDisabled" />
                </el-form-item>
            </el-col> -->
          <el-col :span="12">
            <el-form-item label="碳滤后水质情况-杂质" prop="a29" label-width="180px">
              <el-input v-model="form.a29" placeholder="请输入碳滤后水质情况-杂质" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="碳滤后取样" prop="a10">
              <!-- <el-input
                v-model="form.a10"
                placeholder="请输入碳滤后取样"
                :disabled="openDisabled"
              /> -->
              <el-time-picker :editable="false" clearable v-model="form.a10" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="时间" :disabled="openDisabled">
              </el-time-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="活化砂碳滤总用水量" prop="a30" label-width="140px">
              <el-input v-model="form.a30" placeholder="请输入活化砂碳滤总用水量" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
        </el-row>
        <br>
        <el-divider content-position="center">水质检测结果</el-divider>
        <br>
        <el-row>
          <el-col :span="12">
            <el-form-item label="活化后取样Fe2+（mg/L）" prop="a31" label-width="180px">
              <el-input v-model="form.a31" placeholder="请输入活化后取样Fe2+" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否合格" prop="a35">
              <!-- <el-input v-model="form.a35" placeholder="请输入活化后取样Fe2+" :disabled="openDisabled" /> -->
              <el-select v-model="form.a35">
                <el-option value="是">是</el-option>
                <el-option value="否">否</el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="活化后取样Mn2+（mg/L）" prop="a32" label-width="180px">
              <el-input v-model="form.a32" placeholder="请输入活化后取样Mn2+" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否合格" prop="a36">
              <!-- <el-input v-model="form.a36" placeholder="请输入活化后取样Mn2+" :disabled="openDisabled" /> -->
              <el-select v-model="form.a36">
                <el-option value="是">是</el-option>
                <el-option value="否">否</el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="生产前用水Fe2+(mg/L)" prop="a33" label-width="180px">
              <el-input v-model="form.a33" placeholder="请输入生产前用水Fe2+" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否合格" prop="a37">
              <!-- <el-input v-model="form.a37" placeholder="请输入生产前用水Fe2+" :disabled="openDisabled" /> -->
              <el-select v-model="form.a37">
                <el-option value="是">是</el-option>
                <el-option value="否">否</el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="生产前用水Mn2+(mg/L)" prop="a34" label-width="180px">
              <el-input v-model="form.a34" placeholder="请输入生产前用水Mn2+" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否合格" prop="a38">
              <!-- <el-input v-model="form.a38" placeholder="请输入生产前用水Mn2+" :disabled="openDisabled" /> -->
              <el-select v-model="form.a38">
                <el-option value="是">是</el-option>
                <el-option value="否">否</el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="微生物检测结果" prop="a39" label-width="130px">
              <el-input v-model="form.a39" placeholder="请输入微生物检测结果" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备注" prop="remark">
              <el-input v-model="form.remark" placeholder="请输入备注" :disabled="openDisabled" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="审核人" prop="a40">
              <el-input v-model="form.a40" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="质检员" prop="a41">
              <!-- <el-input v-model="form.a41" placeholder="请输入质检员" :disabled="openDisabled" /> -->
              <el-select v-model="form.a41" placeholder="请选择质检员" style="width: 100%">
                <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="化验员" prop="a42">
              <!-- <el-input v-model="form.a42" placeholder="请输入化验员" :disabled="openDisabled" /> -->
              <el-select v-model="form.a42" filterable allow-create placeholder="请选择质检员" style="width: 100%">
                <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
                <el-form-item label="报表编号" prop="bbbh">
                  <el-input v-model="form.bbbh" placeholder="请输入报表编号" :disabled="openDisabled" />
                </el-form-item>
            </el-col> -->
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer" v-if="!openDisabled">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listCarbon,
  getCarbon,
  delCarbon,
  addCarbon,
  updateCarbon,
} from "@/api/quality/productionline/carbon";
import { getInfo } from "@/api/login";
import { listUser } from "@/api/system/user";

export default {
  name: "Carbon",
  data() {
    return {
      /* 当前用户名 */
      nickName: "",
      userList: [],
      //弹窗是否禁止编辑
      openDisabled: true,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 活化砂碳滤过程记录表格数据
      carbonList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 50,
        a1: null,
        a2: null,
        a3: null,
        a4: null,
        a5: null,
        a6: null,
        a7: null,
        a8: null,
        a9: null,
        a10: null,
        a11: null,
        a12: null,
        a13: null,
        a14: null,
        a15: null,
        a16: null,
        a17: null,
        a18: null,
        a19: null,
        a20: null,
        a21: null,
        a22: null,
        a23: null,
        a24: null,
        a25: null,
        a26: null,
        a27: null,
        a28: null,
        a29: null,
        a30: null,
        a31: null,
        a32: null,
        a33: null,
        a34: null,
        a35: null,
        a36: null,
        a37: null,
        a38: null,
        a39: null,
        a40: null,
        a41: null,
        a42: null,
        jcrq: null,
        bbbh: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  created() {
    this.getList();
    this.queryUserList();
  },
  methods: {
    /** 查询活化砂碳滤过程记录列表 */
    getList() {
      this.loading = true;
      listCarbon(this.queryParams).then((response) => {
        this.carbonList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        a1: null,
        a2: null,
        a3: null,
        a4: null,
        a5: null,
        a6: null,
        a7: null,
        a8: null,
        a9: null,
        a10: null,
        a11: null,
        a12: null,
        a13: null,
        a14: null,
        a15: null,
        a16: null,
        a17: null,
        a18: null,
        a19: null,
        a20: null,
        a21: null,
        a22: null,
        a23: null,
        a24: null,
        a25: null,
        a26: null,
        a27: null,
        a28: null,
        a29: null,
        a30: null,
        a31: null,
        a32: null,
        a33: null,
        a34: null,
        a35: null,
        a36: null,
        a37: null,
        a38: null,
        a39: null,
        a40: null,
        jcrq: null,
        a41: this.nickName,
        a42: this.nickName,
        bbbh: "LK-QF-LS1-10-015-11-05",
        remark: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        delFlag: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.openDisabled = false;
      this.open = true;
      this.title = "添加活化砂碳滤过程记录";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      this.openDisabled = false;
      const id = row.id || this.ids;
      getCarbon(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改活化砂碳滤过程记录";
      });
    },
    /** 查看按钮 */
    handleView(row) {
      this.reset();
      this.openDisabled = true;
      const id = row.id || this.ids;
      getCarbon(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "查看活化砂碳滤过程记录";
      });
    },

    excelhandleView(row){
      this.download(
        "Productionline/carbon/exportexcel?id="+row.id,
        {
          ...this.queryParams,
        },
        "活化砂碳滤过程记录" + this.parseTime(new Date()) + ".xlsx"
      );
    },

    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
            /**打开遮罩层*/
            const rLoading = this.openLoading();
          if (this.form.id != null) {
            updateCarbon(this.form)
              .then((response) => {
                /**成功后执行关闭遮罩层*/
                rLoading.close();
                this.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              })
              .catch((error) => {
                /**请求异常后执行关闭遮罩层*/
                rLoading.close();
              });
          } else {
            addCarbon(this.form)
              .then((response) => {
                /**成功后执行关闭遮罩层*/
                rLoading.close();
                this.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              })
              .catch((error) => {
                /**请求异常后执行关闭遮罩层*/
                rLoading.close();
              });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm(
        '是否确认删除活化砂碳滤过程记录编号为"' + ids + '"的数据项?',
        "警告",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then(function () {
          return delCarbon(ids);
        })
        .then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "Productionline_carbon/carbon/export",
        {
          ...this.queryParams,
        },
        `Productionline_carbon_carbon.xlsx`
      );
    },
    //接收编号
    nameChange(e) {
      this.form.bbbh = e;
    },
    /** 审核按钮操作 */
    handleCheck(row) {
      /* 审核 */
      this.ids.forEach((id) => {
        getCarbon(id).then((response) => {
          if (response.data.a40 != null && response.data.a40 != "") {
            this.msgError(
              '编号为"' + id + '"的数据项已审核完成，无需重复审核！'
            );
          } else {
            let obj = {};
            obj.id = id;
            obj.a40 = this.nickName;
            /* 修改 */
            updateCarbon(obj).then((response) => {
              this.msgSuccess("审核成功");
              this.getList();
            });
          }
        });
      });
    },
    /* 查询用户列表 */
    queryUserList() {
      listUser().then((response) => {
        this.userList = response.rows;
      });
      getInfo().then((response) => {
        this.nickName = response.user.nickName;
      });
    },
  },
};
</script>
